package com.ruoyi.AliYunOss;

import com.ruoyi.doword.utils.AliOSSUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description:
 * @Author: 吕宇宏
 * @Date: 2024/7/9 16:36
 */
@Configuration
public class AliYunConfig {
    @Bean
    @ConditionalOnMissingBean        //当没有这个bean对象的时候创造bean   单例
    public AliOssUtil aliOssUtil(AliOssProperties aliOssProperties) {


        return new AliOssUtil(aliOssProperties.getEndpoint(),aliOssProperties.getAccessKeyId(),
                aliOssProperties.getAccessKeySecret(),aliOssProperties.getBucketName());
    }


}
